package 力扣;

public class leetcode27 {
    public static void main(String[] args) {
        int[] nums={2,2};

    }
    // 定义 0 - left无val值
    public  static int removeElement(int[] nums, int val) {
        int left=0;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i]!=val){
                nums[left]=nums[i];
                left++;
            }
        }
        return left;
    }

}
